package com.bafa.front.admin;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bafa.exceptions.ErrorException;
import com.bafa.front.DaddyServlet;
import com.bafa.services.FixtureServices;

public class AddFixtureToRoundServlet extends AdminServlet {

	@Override
	public void doAdminEvent(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, ErrorException {
		String bye = request.getParameter("bye");
		if(bye!=null && bye.equalsIgnoreCase("bye")){
			message = FixtureServices.addByeFixtureToRound(
					new Integer(request.getParameter("roundId")),
					new Integer(request.getParameter("seasonId")),
					new Integer(request.getParameter("teamA")),
					new Integer(request.getParameter("positionA")));
		}
		else{
			message = FixtureServices.addFixtureToRound(
					new Integer(request.getParameter("roundId")),
					new Integer(request.getParameter("day")),
					new Integer(request.getParameter("month")),
					new Integer(request.getParameter("year")),
					new Integer(request.getParameter("hour")),
					new Integer(request.getParameter("minutes")),
					new Integer(request.getParameter("seasonId")),
					new Integer(request.getParameter("positionA")),
					new Integer(request.getParameter("positionB")),
					new Integer(request.getParameter("teamA")),
					new Integer(request.getParameter("teamB")));
		}
		url = "logon.bafa";
	}
}
